﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Webadmin_Modules_NewsOne_Move : bzAdminUCBase
{
    //----------------------------------------------------------
    public string _Act = "";
    public string _ID = "";
    public string _CateID = "";
    override protected void loadAction()
    {
        _Act = Request.QueryString["Act"] == null ? "" : Request.QueryString["Act"];
        _ID = Request.QueryString["ID"] == null ? "-1" : Request.QueryString["ID"];
        _CateID = Request.QueryString["CateID"] == null ? "-1" : Request.QueryString["CateID"];
        if (!IsPostBack)
        {
            //this.loadCate();
            this.btnUpdate.Text = this.AdminLang["Move"].ToString();
            this.Chk.Value = Request.Form["Chk"] == null ? "" : Request.Form["Chk"];
            this.Navigator = this.AdminLang["MenuNews"].ToString() + this.AdminLang["GeneralArrow"].ToString() + this.AdminLang["MenuNewsList"].ToString() + this.AdminLang["GeneralArrow"].ToString() + this.AdminLang["Move"].ToString();
        }
    }
    //private void loadCate()
    //{
    //    DataTable dt = new bzNewsCate().getTable("", "-1", "0", "0","-1");
    //    this.cboCategory.DataSource = dt;
    //    this.cboCategory.DataTextField = "Name" + Session["Lang"];
    //    this.cboCategory.DataValueField = "CateID";
    //    this.cboCategory.DataBind();

    //    this.cboCategory.Items.Insert(0, new ListItem("-----Lựa chọn danh mục-----", "-1"));
    //    this.cboCategory.SelectedValue = _CateID;
    //}
    private bzNewsOne bz = new bzNewsOne();
    protected void Page_Load(object sender, EventArgs e)
    {
        this.initSiteLang(bzSiteOption.Group.Administrator, bzSiteOption.Note.NewsOne, "NewsOne");

    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        if (this.AllowEdit)
        {
            if (bz.moveCate(this.Chk.Value.Split(','), this.cboCategory.SelectedValue) > 0)
            {
                Response.Redirect(Session["Page"].ToString() + "?CateID=" + this.cboCategory.SelectedValue);
            }
        }
        else { Response.Write(bzStringClass.AlertPermission); }
    }
}
